package com.fortune.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("logout")
public class LogoutController {

    @Autowired
    private HttpSession httpSession;

    @RequestMapping(value = "", method = RequestMethod.GET)
    public ModelAndView indexOfAll() throws Exception {
        ModelAndView mv = new ModelAndView("applogin");
        httpSession.removeAttribute("users");
        return mv;
    }

}
